package main

import "fmt"

type address struct {
	province string
	city     string
}

type workPlace struct {
	province string
	city     string
}

type person struct {
	name    string
	age     int
	address //匿名嵌套结构体
}

type company struct {
	name     string
	province string
	addr     address
	workPlace
}

func main() {
	p1 := person{
		name: "zl",
		age:  17,
		address: address{
			province: "山东",
			city:     "威海",
		},
	}
	fmt.Println(p1)
	fmt.Println(p1.address.city)
	fmt.Println(p1.city) //语法糖
	p1.address.city = "wer"
	fmt.Println(p1.city) //语法糖
}
